package com.chinalife.vote.common.domain;

import lombok.Data;

import java.io.Serializable;

/**
 * @author liuxin
 */
@Data
public class ResultBeen<T> implements Serializable {


	private static final long serialVersionUID = 1L;

	private Integer code ;

	private String msg ;

	private T data;

	public ResultBeen() {
	}


	public ResultBeen(int code, String msg, T data){
		this.code = code;
		this.msg = msg;
		this.data = data;
	}

	public static ResultBeen success(){
		return success(null);
	}

	public static ResultBeen success(Object obj){
		return new ResultBeen(StatusCode.OK.getValue(), StatusCode.OK.getDescription() , obj);
	}

	public static ResultBeen fail(String msg){
		return fail(StatusCode.ERROR,msg);
	}

	public static ResultBeen fail(StatusCode statusCode, String msg){
		return new ResultBeen(statusCode.getValue(), msg , null);
	}
}
